/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bookshop.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Thibault
 */
@Embeddable
public class CustomerorderBookPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "CustomerOrder_id", nullable = false)
    private int customerOrderid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Book_id", nullable = false)
    private int bookid;

    public CustomerorderBookPK() {
    }

    public CustomerorderBookPK(int customerOrderid, int bookid) {
        this.customerOrderid = customerOrderid;
        this.bookid = bookid;
    }

    public int getCustomerOrderid() {
        return customerOrderid;
    }

    public void setCustomerOrderid(int customerOrderid) {
        this.customerOrderid = customerOrderid;
    }

    public int getBookid() {
        return bookid;
    }

    public void setBookid(int bookid) {
        this.bookid = bookid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) customerOrderid;
        hash += (int) bookid;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CustomerorderBookPK)) {
            return false;
        }
        CustomerorderBookPK other = (CustomerorderBookPK) object;
        if (this.customerOrderid != other.customerOrderid) {
            return false;
        }
        if (this.bookid != other.bookid) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bookshop.entity.CustomerorderBookPK[ customerOrderid=" + customerOrderid + ", bookid=" + bookid + " ]";
    }
    
}
